<!DOCTYPE html>
<html lang='zh-cn'>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta http-equiv="Cache-Control"  content="no-transform">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>登录 - 后台管理系统</title>

<link rel='stylesheet' href='http://cdn.staticfile.org/zui/1.5.0/css/zui.min.css' type='text/css' media='screen'/>
<link rel='stylesheet' href='${req.contextPath}/css/admin/all.admin.css' type='text/css' media='screen'/>

<style>.user-control-nav{margin-bottom: 20px;}
@media (max-width: 480px) { .hidden-xxs {display: none} .page {font-size: 12px}}
@media (max-width: 400px) { .hidden-xxxs {display: none}}
#login .panel{width: 80%; margin: 5% auto;max-width: 450px;}
#login .panel-body{min-height: 230px;}
#login .panel-heading{background-color: transparent;}

.btn-oauth{text-align: left;padding-left: 130px;font-size: 24px;line-height: 50px;position: relative;text-shadow: 0 1px 0 rgba(0,0,0,0.5);color: #333;background-color: #FCFCFC;border: 1px solid #DEDEDE;}
.btn-oauth:hover{color: #333;background-color: #E8E8E8;border-color: #ccc;-moz-box-shadow: 0 2px 1px rgba(0,0,0,0.1);-webkit-box-shadow: 0 2px 1px rgba(0, 0, 0, 0.1);box-shadow: 0 2px 1px rgba(0, 0, 0, 0.1);}
.btn-oauth .icon{font-size: 40px;position: absolute;left: 75px; text-shadow:none;}
.btn-oauth .icon:before{display: none;}

#adminLogin { max-width: 500px; margin: 8% auto; padding: 0; background-color: #FFF; border: 1px solid #DDD; box-shadow: 0px 2px 20px rgba(0, 0, 0, 0.2);border-radius: 6px;}
#responser { line-height: 30px; font-size: 12px }
#logo { margin-bottom: 10px; }
#adminLogin #siteName {padding: 15px 20px 15px; background: #EDF3FE; border-bottom: 1px solid #e5e5e5; border-radius: 6px 6px 0 0}
#adminLogin #ajaxForm {padding: 20px 20px;}
#adminLogin #submit {min-width: 100px;}

@media (max-width: 700px){ #adminLogin{border: none;margin: 0 auto;box-shadow: none;padding: 20px 15px;background-color: #fff; margin: 0 auto; border-radius: 0} body {padding: 0;} .container {padding: 0;} #adminLogin #siteName {background: #fff}}
@media (max-width: 767px) {#login .panel {margin: 20px auto; width: 100%;} #login .panel-heading {padding: 0 0 10px 0;} #login .panel-body {padding: 10px 0; min-height: inherit;} .btn-oauth {padding-left: 80px;} .btn-oauth .icon {left: 20px;}}

#siteName{font-size:14px; color:#444; font-weight:600; display:block;}
hr{margin-top:8px;}
</style>

<link rel='icon' href='${req.contextPath}/images/leaf.ico' type='image/x-icon' />
<link rel='shortcut icon' href='${req.contextPath}/images/leaf.ico' type='image/x-icon' />

<!--[if lt IE 9]>
<script src='${req.contextPath}/js/common/all.ie8.js' type='text/javascript'></script>
<![endif]-->
<!--[if lt IE 10]>
<script src='${req.contextPath}/js/common/all.ie9.js' type='text/javascript'></script>
<![endif]-->
</head>
<body>

<div class='container'>
  <div id='adminLogin'>
    <div id='siteName'>
      	后台管理系统
    </div>
    <form method='post' data-checkfingerprint='1'>
      <div id='formError' class='alert alert-danger hiding'></div>
      <div class='row'>
        <div class='col-xs-4 text-center'>
        	<img src='${req.contextPath}/images/logo.login.admin.png'  />
        </div>
        <div class='col-xs-8'>
          <table class="table table-form">
            <tr>
              	<th class='w-60px'>用户名</th>
              	<td>
              		<input type='text' name='name' id='name' value='demo' class='form-control' placeholder='请输入用户名或Email' />
				</td>
            </tr>
            <tr>
              	<th>密码</th>
              	<td>
              		<input type='password' name='password' id='password' value='123' class='form-control' placeholder='请输入密码' />
				</td>
            </tr>
            <tr>
              <th><a href='' data-toggle='modal' class='hidden captchaModal'>保存</a></th>
              <td>
                 <input type='submit' id='submit' class='btn btn-primary btn' value='登录'  data-loading='稍候...' />
              </td>
            </tr>
          </table>
          <input type='hidden' name='referer' id='referer' value=''  />
        </div>
      </div>
    </form>
  </div>
</div>

<script src='http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js' charset="utf-8" type='text/javascript'></script>
<script src='${req.contextPath}/js/common/md5.js' charset="utf-8" type='text/javascript'></script>
<script>
$(function(){
	$("#name").focus();//获取焦点
	
	$('#submit').click(function(){
	    var pwd = $('#password').val();
		var password = hexMD5(pwd);
	    $.ajax({
	        type: "POST",
	        data:"user.user_name=" + $('#name').val() + '&user.password=' + password,
	        url:"${req.contextPath}/login.do",
	        dataType:'json',
	        success:function(data){
	            if(data.errcode == 0) return location.href="${req.contextPath}/"+data.result.locate;
	            if(data.errcode != 0) showFormError(data.msg);
	      	},
	      	error:function(data){showFormError(data.msg);}
	    })
	    return false;
	});
});

function showFormError(text){
    if(text == '') return true;
    var error = $('#formError').text(text);
    var parent = error.closest('.form-group');
    if(parent.length) parent.show();
    else $('#formError').show();
}
</script>
</body>
</html>